#include "core/main.h"

void ReplayCollection::LoadAllReplays(Game &game, const string &playerFilter, bool useTestReplays)
{
    Directory dir("../replays/" + game.Name() + "/");
    for(UINT fileIndex = 0; fileIndex < dir.Files().size(); fileIndex++)
    {
        const string &replayName = dir.Files()[fileIndex];
        if( (useTestReplays  && StringHelper::StartsWith(replayName, "test")) ||
            (!useTestReplays && !StringHelper::StartsWith(replayName, "test")) )
        {
            Replay *newReplay = new Replay;
            newReplay->Load(game, dir.Path() + replayName);
            _replays.push_back(newReplay);
        }
    }
}

UINT ReplayCollection::TotalFrameCount() const
{
    UINT result = 0;
    for(UINT replayIndex = 0; replayIndex < _replays.size(); replayIndex++)
    {
        result += _replays[replayIndex]->Frames().size();
    }
    return result;
}
